package com.Luoyi.springframework.beans;

import java.util.ArrayList;
import java.util.List;

public class PropertyValues {
    private final List<PropertyValue> propertyValueList = new ArrayList<>();

    //添加属性
    public void addPropertyValue(PropertyValue pv){
        this.propertyValueList.add(pv);
    }

    //获取当前属性集合
    public PropertyValue[] getPropertyValues(){
        return this.propertyValueList.toArray(new PropertyValue[0]);
    }

    //根据名字获取属性
    public PropertyValue getPropertyValues(String propertyName){
        for (PropertyValue propertyValue : propertyValueList) {
            if(propertyValue.getName().equals(propertyName)){
                return propertyValue;
            }
        }
        return  null;
    }
}
